﻿@{
    ViewBag.Title = "实时数据";
    Layout = "~/Views/Shared/Main.cshtml";
}
<div class="row">
    @{
        var wsd = ViewData["wsd"] as ASoft.Base.WeatherStationData;
    }
    <span class="label label-important">气象数据</span>
    @if (wsd == null)
    { 
        <span class="label label-info">无</span>
    }
    else
    {
        if (wsd.Id > 0)
        { 
        <span class="label label-warning">模拟数据</span>
        }
        <span class="label">光照[KLUX]</span><span class="label label-info">@wsd.光照</span>
        <span class="label">雨雪</span><span class="label label-info">@(wsd.雨雪 == 0 ? "无雨雪" : "有雨雪")</span>
        <span class="label">风速[米/秒]</span><span class="label label-info">@wsd.风速</span>
        <span class="label">室外温度[℃]</span><span class="label label-info">@wsd.室外温度</span>
        <span class="label">风向</span><span class="label label-info">@Asoft.Web.Models.PConvert.WindDirection(wsd.风向)</span>
        <span class="label">时间</span><span class="label label-info">@wsd.时间.ToString("yyyy-MM-dd HH:mm:ss")</span>
    }
</div>
<table class="table table-hover">
    <thead>
        <tr>
            <th>Id</th>
            <th>名称</th>
            <th>室温1</th>
            <th>室温2</th>
            <th>湿度1</th>
            <th>湿度2</th>
            <th style="width: 26px">室内光照</th>
            <th style="width: 26px">室内CO2</th>
            <th style="width: 26px">土壤水分</th>
            <th style="width: 26px">PH</th>
            <th style="width: 26px">EC</th>
            <th style="width: 26px">遮阳网</th>
            <th style="width: 26px">湿帘泵</th>
            <th style="width: 26px">保温被</th>
            <th style="width: 26px">加湿</th>
            <th style="width: 26px">排风扇</th>
            <th style="width: 26px">高温报警</th>
            <th style="width: 26px">低温报警</th>
            <th style="width: 26px">高湿报警</th>
            <th style="width: 26px">低湿报警</th>
            <th>时间</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in (List<ASoft.Base.WebRoomData>)ViewData["grid"])
        {
            <tr>
                <td>@item.Id</td>
                <td>@item.RoomName</td>
                <td>@item.室内温度1</td>
                <td>@item.室内温度2</td>
                <td>@item.湿度1</td>
                <td>@item.湿度2</td>
                <td>@item.室内光照</td>
                <td>@item.室内CO2</td>
                <td>@item.土壤湿度</td>
                <td>@item.Ph</td>
                <td>@item.Ec</td>
                <td>@item.遮阳网位置</td>
                <td>@item.湿帘泵位置</td>
                <td>@item.保温被位置</td>
                <td>@Asoft.Web.Models.PConvert.OpenClose(item.灌溉加湿)</td>
                <td>@Asoft.Web.Models.PConvert.OpenClose(item.排风扇)</td>
                <td>@item.温室高温报警位</td>
                <td>@item.温室低温报警位</td>
                <td>@item.温室高湿报警位</td>
                <td>@item.温室低湿报警位</td>
                <td>@item.时间.ToString("yyyy-MM-dd HH:mm:ss")</td>
            </tr>
        }
    </tbody>
</table>
<div class="row">
    @Html.Partial("TablePager")
</div>
<script type="text/javascript">
    $(function () {
        setInterval("window.location.reload()", 1000 * @ViewData["reloadsecond"]);
    });
</script>
